import { S } from '../../s';
import { IPSAppDEAction } from '../../app/dataentity/ipsapp-deaction';
import { IPSAppDEDataSet } from '../../app/dataentity/ipsapp-dedata-set';
import { IPSAppDEField } from '../../app/dataentity/ipsapp-defield';
import { IPSAppDataEntity } from '../../app/dataentity/ipsapp-data-entity';
import { IPSControlXDataContainer } from '../ipscontrol-xdata-container';
import { PSControlItemImpl2 } from '../pscontrol-item-impl2';
import { IPSSysMapItem } from './ipssys-map-item';
import { IPSDEContextMenu } from '../toolbar/ipsdecontext-menu';
import { IPSDEOPPriv } from '../../dataentity/priv/ipsdeoppriv';
import { IPSLanguageRes } from '../../res/ipslanguage-res';
import { IPSSysCss } from '../../res/ipssys-css';
import { IPSSysImage } from '../../res/ipssys-image';

export class PSSysMapItemImpl
  extends PSControlItemImpl2
  implements IPSSysMapItem, IPSControlXDataContainer
{
  protected altitudepsappdefield: IPSAppDEField;
  getAltitudePSAppDEField(): IPSAppDEField | null {
    if (this.altitudepsappdefield != null) return this.altitudepsappdefield;
    const value = this.M.getAltitudePSAppDEField;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.altitudepsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.altitudepsappdefield;
  }

  get bKColor(): string {
    return this.M.bKColor;
  }

  protected bkcolorpsappdefield: IPSAppDEField;
  getBKColorPSAppDEField(): IPSAppDEField | null {
    if (this.bkcolorpsappdefield != null) return this.bkcolorpsappdefield;
    const value = this.M.getBKColorPSAppDEField;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.bkcolorpsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.bkcolorpsappdefield;
  }

  get borderColor(): string {
    return this.M.borderColor;
  }

  get borderWidth(): number {
    return this.M.borderWidth;
  }

  protected clspsappdefield: IPSAppDEField;
  getClsPSAppDEField(): IPSAppDEField | null {
    if (this.clspsappdefield != null) return this.clspsappdefield;
    const value = this.M.getClsPSAppDEField;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.clspsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.clspsappdefield;
  }

  get color(): string {
    return this.M.color;
  }

  protected colorpsappdefield: IPSAppDEField;
  getColorPSAppDEField(): IPSAppDEField | null {
    if (this.colorpsappdefield != null) return this.colorpsappdefield;
    const value = this.M.getColorPSAppDEField;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.colorpsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.colorpsappdefield;
  }

  protected contentpsappdefield: IPSAppDEField;
  getContentPSAppDEField(): IPSAppDEField | null {
    if (this.contentpsappdefield != null) return this.contentpsappdefield;
    const value = this.M.getContentPSAppDEField;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.contentpsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.contentpsappdefield;
  }

  get customCond(): string {
    return this.M.customCond;
  }

  protected data2psappdefield: IPSAppDEField;
  getData2PSAppDEField(): IPSAppDEField | null {
    if (this.data2psappdefield != null) return this.data2psappdefield;
    const value = this.M.getData2PSAppDEField;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.data2psappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.data2psappdefield;
  }

  protected datapsappdefield: IPSAppDEField;
  getDataPSAppDEField(): IPSAppDEField | null {
    if (this.datapsappdefield != null) return this.datapsappdefield;
    const value = this.M.getDataPSAppDEField;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.datapsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.datapsappdefield;
  }

  get dynaClass(): string {
    return this.M.dynaClass;
  }

  protected grouppsappdefield: IPSAppDEField;
  getGroupPSAppDEField(): IPSAppDEField | null {
    if (this.grouppsappdefield != null) return this.grouppsappdefield;
    const value = this.M.getGroupPSAppDEField;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.grouppsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.grouppsappdefield;
  }

  protected iconpsappdefield: IPSAppDEField;
  getIconPSAppDEField(): IPSAppDEField | null {
    if (this.iconpsappdefield != null) return this.iconpsappdefield;
    const value = this.M.getIconPSAppDEField;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.iconpsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.iconpsappdefield;
  }

  protected idpsappdefield: IPSAppDEField;
  getIdPSAppDEField(): IPSAppDEField | null {
    if (this.idpsappdefield != null) return this.idpsappdefield;
    const value = this.M.getIdPSAppDEField;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.idpsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.idpsappdefield;
  }

  get itemStyle():
    | 'POINT'
    | 'POINT2'
    | 'POINT3'
    | 'POINT4'
    | 'LINE'
    | 'LINE2'
    | 'LINE3'
    | 'LINE4'
    | 'REGION'
    | 'REGION2'
    | 'REGION3'
    | 'REGION4'
    | 'USER'
    | 'USER2'
    | 'USER3'
    | 'USER4' {
    return this.M.itemStyle;
  }

  get itemType(): string {
    return this.M.itemType;
  }

  protected latitudepsappdefield: IPSAppDEField;
  getLatitudePSAppDEField(): IPSAppDEField | null {
    if (this.latitudepsappdefield != null) return this.latitudepsappdefield;
    const value = this.M.getLatitudePSAppDEField;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.latitudepsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.latitudepsappdefield;
  }

  protected longitudepsappdefield: IPSAppDEField;
  getLongitudePSAppDEField(): IPSAppDEField | null {
    if (this.longitudepsappdefield != null) return this.longitudepsappdefield;
    const value = this.M.getLongitudePSAppDEField;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.longitudepsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.longitudepsappdefield;
  }

  get maxSize(): number {
    return this.M.maxSize;
  }

  get modelObj(): string {
    return this.M.modelObj;
  }

  protected namepslanguageres: IPSLanguageRes;
  getNamePSLanguageRes(): IPSLanguageRes | null {
    return (
      this.namepslanguageres ||
      (this.namepslanguageres = this.fillObjectModel(
        S._276,
        this.M.getNamePSLanguageRes,
        S._2bd,
      ) as IPSLanguageRes)
    );
  }

  protected ordervaluepsappdefield: IPSAppDEField;
  getOrderValuePSAppDEField(): IPSAppDEField | null {
    if (this.ordervaluepsappdefield != null) return this.ordervaluepsappdefield;
    const value = this.M.getOrderValuePSAppDEField;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.ordervaluepsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.ordervaluepsappdefield;
  }

  protected psappdedataset: IPSAppDEDataSet;
  getPSAppDEDataSet(): IPSAppDEDataSet | null {
    if (this.psappdedataset != null) return this.psappdedataset;
    const value = this.M.getPSAppDEDataSet;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.psappdedataset = ipsappdataentity.findPSAppDEDataSet(value);
    }
    return this.psappdedataset;
  }

  protected psappdataentity: IPSAppDataEntity;
  getPSAppDataEntity(): IPSAppDataEntity | null {
    return (
      this.psappdataentity ||
      (this.psappdataentity = this.fillObjectModel(
        S._f,
        this.M.getPSAppDataEntity,
        S._2aa,
      ) as IPSAppDataEntity)
    );
  }

  protected psdecontextmenu: IPSDEContextMenu;
  getPSDEContextMenu(): IPSDEContextMenu | null {
    return (
      this.psdecontextmenu ||
      (this.psdecontextmenu = this.fillObjectModel(
        S._263,
        this.M.getPSDEContextMenu,
        S._30c,
      ) as IPSDEContextMenu)
    );
  }

  protected pssyscss: IPSSysCss;
  getPSSysCss(): IPSSysCss | null {
    return (
      this.pssyscss ||
      (this.pssyscss = this.fillObjectModel(
        S._278,
        this.M.getPSSysCss,
        S._2ac,
      ) as IPSSysCss)
    );
  }

  protected pssysimage: IPSSysImage;
  getPSSysImage(): IPSSysImage | null {
    return (
      this.pssysimage ||
      (this.pssysimage = this.fillObjectModel(
        S._27b,
        this.M.getPSSysImage,
        S._2ad,
      ) as IPSSysImage)
    );
  }

  get radius(): number {
    return this.M.radius;
  }

  protected removepsappdeaction: IPSAppDEAction;
  getRemovePSAppDEAction(): IPSAppDEAction | null {
    if (this.removepsappdeaction != null) return this.removepsappdeaction;
    const value = this.M.getRemovePSAppDEAction;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.removepsappdeaction = ipsappdataentity.findPSAppDEAction(value);
    }
    return this.removepsappdeaction;
  }

  protected removepsdeoppriv: IPSDEOPPriv;
  getRemovePSDEOPPriv(): IPSDEOPPriv | null {
    return (
      this.removepsdeoppriv ||
      (this.removepsdeoppriv = this.fillObjectModel(
        S._270,
        this.M.getRemovePSDEOPPriv,
        S._30e,
      ) as IPSDEOPPriv)
    );
  }

  protected shapeclspsappdefield: IPSAppDEField;
  getShapeClsPSAppDEField(): IPSAppDEField | null {
    if (this.shapeclspsappdefield != null) return this.shapeclspsappdefield;
    const value = this.M.getShapeClsPSAppDEField;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.shapeclspsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.shapeclspsappdefield;
  }

  get shapeDynaClass(): string {
    return this.M.shapeDynaClass;
  }

  protected shapepssyscss: IPSSysCss;
  getShapePSSysCss(): IPSSysCss | null {
    return (
      this.shapepssyscss ||
      (this.shapepssyscss = this.fillObjectModel(
        S._278,
        this.M.getShapePSSysCss,
        S._3fb,
      ) as IPSSysCss)
    );
  }

  protected tag2psappdefield: IPSAppDEField;
  getTag2PSAppDEField(): IPSAppDEField | null {
    if (this.tag2psappdefield != null) return this.tag2psappdefield;
    const value = this.M.getTag2PSAppDEField;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.tag2psappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.tag2psappdefield;
  }

  protected tagpsappdefield: IPSAppDEField;
  getTagPSAppDEField(): IPSAppDEField | null {
    if (this.tagpsappdefield != null) return this.tagpsappdefield;
    const value = this.M.getTagPSAppDEField;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.tagpsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.tagpsappdefield;
  }

  protected textpsappdefield: IPSAppDEField;
  getTextPSAppDEField(): IPSAppDEField | null {
    if (this.textpsappdefield != null) return this.textpsappdefield;
    const value = this.M.getTextPSAppDEField;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.textpsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.textpsappdefield;
  }

  protected timepsappdefield: IPSAppDEField;
  getTimePSAppDEField(): IPSAppDEField | null {
    if (this.timepsappdefield != null) return this.timepsappdefield;
    const value = this.M.getTimePSAppDEField;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.timepsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.timepsappdefield;
  }

  protected tipspsappdefield: IPSAppDEField;
  getTipsPSAppDEField(): IPSAppDEField | null {
    if (this.tipspsappdefield != null) return this.tipspsappdefield;
    const value = this.M.getTipsPSAppDEField;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.tipspsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.tipspsappdefield;
  }

  get enableEditData(): boolean {
    return this.M.enableEditData;
  }

  get enableExport(): boolean {
    return this.M.enableExport != null ? this.M.enableExport : false;
  }

  get enableFilter(): boolean {
    return this.M.enableFilter;
  }

  get enableImport(): boolean {
    return this.M.enableImport != null ? this.M.enableImport : false;
  }

  get enableNewData(): boolean {
    return this.M.enableNewData;
  }

  get enableQuickCreate(): boolean {
    return this.M.enableQuickCreate;
  }

  get enableQuickSearch(): boolean {
    return this.M.enableQuickSearch != null ? this.M.enableQuickSearch : false;
  }

  get enableRemoveData(): boolean {
    return this.M.enableRemoveData;
  }

  get enableSearch(): boolean {
    return this.M.enableSearch != null ? this.M.enableSearch : false;
  }

  get enableViewData(): boolean {
    return this.M.enableViewData;
  }

  get loadDefault(): boolean {
    return this.M.loadDefault != null ? this.M.loadDefault : true;
  }

  get pickupMode(): boolean {
    return this.M.pickupMode != null ? this.M.pickupMode : false;
  }

  get readOnly(): boolean {
    return this.M.readOnly != null ? this.M.readOnly : false;
  }
  get cls(): string {
    return 'PSSysMapItemImpl';
  }
  instanceof(cls: string): boolean {
    if (
      cls == S._116 ||
      cls == S._4b ||
      cls == S._45 ||
      cls == S._125 ||
      cls == S._126
    )
      return true;
    return super.instanceof(cls);
  }
}
